package com.tencent.mm.vending.e;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;

public class VendEc<T extends VendEa> implements VendEa, VendEb<T> {
    private List<WeakReference<T>> Gdm = new ArrayList<>();
    private boolean Gdn = true;

    @Override
    public void dead() {
        if (this.Gdn) {
            for (WeakReference weakReference : this.Gdm) {
                VendEa aVar = (VendEa) weakReference.get();
                if (aVar != null) {
                    aVar.dead();
                }
            }
            this.Gdm.clear();
            this.Gdn = false;
        }
    }

    @Override
    public void keep(T t) {
        if (this.Gdn) {
            this.Gdm.add(new WeakReference<>(t));
        } else if (t != null) {
            t.dead();
        }
    }
}
